package com.j283_5.wisdom_park.controller.visitor_management;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.j283_5.wisdom_park.common.result.ResultData;
import com.j283_5.wisdom_park.common.utils.FormatTool;
import com.j283_5.wisdom_park.mapper.VisitorsMapper;
import com.j283_5.wisdom_park.pojo.Visitors;
import com.j283_5.wisdom_park.vo.visitor_management.UserIoVo;
import com.j283_5.wisdom_park.vo.visitor_management.VisitorsInfoVo;
import com.j283_5.wisdom_park.vo.visitor_management.VisitorsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.util.unit.DataUnit;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.websocket.server.PathParam;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 访客表 前端控制器
 * </p>
 *
 * @author 蒋翔
 * @since 2022-04-29
 */
@RestController
@RequestMapping("/visitors")
@Api(value = "访客信息登记",tags = "访客信息登记",produces="蒋翔")
public class VisitorsController {
//    @Resource
//    private VisitorsMapper visitorsMapper;


    @RequestMapping(value = "/findOneVisitors/{visId}" , method = RequestMethod.POST)
    @ApiOperation(value = "访客信息详情",notes = "查询访客信息详情",produces="蒋翔", response = ResultData.class)
    public ResultData findOneVisitors(@PathParam("visId") Integer visId){
        ArrayList<UserIoVo> userIoVoList = new ArrayList<>();
        UserIoVo vo1 = new UserIoVo("张三", "18767256412", new Timestamp(System.currentTimeMillis()), new Timestamp(System.currentTimeMillis()));
        UserIoVo vo2 = new UserIoVo("张三", "18767256412", new Timestamp(System.currentTimeMillis()), new Timestamp(System.currentTimeMillis()));
        userIoVoList.add(vo1);
        userIoVoList.add(vo2);
        VisitorsInfoVo visitorsInfoVo = new VisitorsInfoVo("张三", "18767256412", "男", "大学学历", "绑定微信号",
                "人脸地址", "二维码", "企业", "***公司", "李四", "13208432854", "A1幢", "502", new Timestamp(System.currentTimeMillis()), new Timestamp(System.currentTimeMillis()), userIoVoList);
        return ResultData.ok().data(visitorsInfoVo);
    }

    @RequestMapping(value = "/visitorsList" , method = RequestMethod.GET)
    @ApiOperation(value = "所有访客信息查询",notes = "查询访客信息（分页）",produces="蒋翔", response = ResultData.class)
    public ResultData visitorsList(@Param("page") Page<Visitors> page,@Param("visitors") Visitors visitors){
        List<VisitorsVo> visitorsVoList = new ArrayList<>();
        VisitorsVo visitorsVo1 = new VisitorsVo(1, "张三", "18767256412", "企业", "****公司", "是", "陕G12345", new Timestamp(System.currentTimeMillis()));
        VisitorsVo visitorsVo2 = new VisitorsVo(2, "李四", "13208432854", "企业", "****公司", "否", "", new Timestamp(System.currentTimeMillis()));
        visitorsVoList.add(visitorsVo1);
        visitorsVoList.add(visitorsVo2);
        return ResultData.ok().data(visitorsVoList);
    }

}

